package cn.iocoder.yudao.hires.mapper;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.hires.entity.NoticeOfferDO;
import cn.iocoder.yudao.hires.vo.noticeoffer.NoticeOfferPageReqVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 下游-Offer通知 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface NoticeOfferMapper extends BaseMapperX<NoticeOfferDO> {

    default PageResult<NoticeOfferDO> selectPage(NoticeOfferPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<NoticeOfferDO>().eqIfPresent(NoticeOfferDO::getUserId, reqVO.getUserId()).likeIfPresent(NoticeOfferDO::getCompanyName, reqVO.getCompanyName()).eqIfPresent(NoticeOfferDO::getPositionId, reqVO.getPositionId()).likeIfPresent(NoticeOfferDO::getPositionName, reqVO.getPositionName()).eqIfPresent(NoticeOfferDO::getOfferSalary, reqVO.getOfferSalary()).eqIfPresent(NoticeOfferDO::getTrialPeriod, reqVO.getTrialPeriod()).betweenIfPresent(NoticeOfferDO::getWorkTime, reqVO.getWorkTime()).eqIfPresent(NoticeOfferDO::getWorkAddress, reqVO.getWorkAddress()).betweenIfPresent(NoticeOfferDO::getReportTime, reqVO.getReportTime()).eqIfPresent(NoticeOfferDO::getOfferType, reqVO.getOfferType()).eqIfPresent(NoticeOfferDO::getStatus, reqVO.getStatus()).eqIfPresent(NoticeOfferDO::getContent, reqVO.getContent()).eqIfPresent(NoticeOfferDO::getAttachmentUrl, reqVO.getAttachmentUrl()).eqIfPresent(NoticeOfferDO::getIsRead, reqVO.getIsRead()).betweenIfPresent(NoticeOfferDO::getCreateTime, reqVO.getCreateTime()).orderByDesc(NoticeOfferDO::getId));
    }

    List<NoticeOfferDO> getNoticeOfferList(@Param("userId") Long userId, @Param("tenantName") String tenantName, @Param("tenantId") Long tenantId, @Param("status") Integer status);

}